package com.yanglei.util;

public class CharacterUtil {

	public static final int LOGIN = 1;

	public static final int USER_LIST = 4;

	public static final int CLIENT_MESSAGE = 2;

	public static final int SERVER_MESSAGE = 3;

	public static final int CLOSE_SERVER_WINDOW = 6;

	public static final int CLOSE_CLIENT_WINDOW = 5;

	public static final int CLOSE_CLIENT_WINDOW_CONFIRMATION = 7;

	public static final int SINGLE_CLIENT_SERVER=9;
	
	public static final int SINGLE_REQUEST=10;
	
    public static final int SINGLE_RESPONCE=11;
    
    public static final int REMOVE_CLIENT=12;
    
    public static final int SINGLE_CLIENT_CLOSE=13;
    
    public static final int SAME_SINGLE_NAME=14;
    
    public static final int SEND_FILE_REQUEST=15;
    
    public static final int SEND_FILE_RESPONSE=16;
	/**
	 * 判断给定字符是否为空
	 * 
	 * */
	public static boolean isEmpty(String str) {
		if ("".equals(str)) {
			return true;
		}
		return false;
	}

	/**
	 * 判断给定的字符串是否是数字
	 * 
	 * */
	public static boolean isNumber(String str) {
		for (int i = 0; i < str.length(); i++) {
			if (!Character.isDigit(str.charAt(i))) {
				return false;
			}
		}

		return true;
	}

	/**
	 * 判断服务器端口号是否在正确的范围内
	 * 
	 * */

	public static boolean isPortCorrect(String port) {
		int temp = Integer.parseInt(port);

		if (temp <= 1024 || temp > 65535) {
			return false;
		}

		return true;
	}

}
